<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title></title>
		<link rel="stylesheet" href="__OEM__/css/iconfont.css" />
		<link rel="stylesheet" href="__OEM__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<div class="rigtop">
						<span class="title">账户中心</span>
					</div>
					<div class="indrig_con" style="position: relative;">
						<div class="zizh_btnbox" style="top: -88px; right: 20px;">
							<button class="zizh_btn" type="button" onclick="show_agent()">修改信息</button>
						</div>
						<!--基本信息内容-->
						<div class="shxx_list">
							<div class="shxx_item">
								<div class="shxx_title">基本信息</div>
								<div class="shxx_jibbox clearfix">
									<div class="shxx_jbleft">
										<div class="shxx_row clearfix">
											<div class="left">系统角色</div>
											<div class="right">
												<p><em>
								                {switch name="$data.user_level"}
												{case value="1"}admin{/case}
												{case value="4"}省级代理商{/case}
											    {case value="2"}市级代理商{/case}
											    {default /}区域运营商
												{/switch}
								                </em>(<em>
								                {switch name="$data.user_type"}
											    {case value="1"}系统管理员{/case}
											    {case value="2"}管理员{/case}
											    {default /}财务
												{/switch}
								                </em>)</p>
											</div>
										</div>
										<div class="shxx_row clearfix">
											<div class="left">用户帐号</div>
											<div class="right">
												<p><em>{$data.mobile}</em></p>
											</div>
										</div>
										<div class="shxx_row clearfix">
											<div class="left">用户地址</div>
											<div class="right">
												<p><em>{$data.addres}</em></p>
											</div>
										</div>
										{if $data.user_type == 1}
										<div class="shxx_row clearfix">
											<div class="left">帐户余额</div>
											<div class="right">
												<p><em>{$data.balance}元</em>
													<a href="javascript:;" onclick="yue_tixian()" class="edit">提现</a>
													<a href="{:url('index/yue_record')}" class="green">记录</a>
												</p>
											</div>
										</div>
											{if $data.user_level==1}
											<!--<div class="shxx_row clearfix">
												<div class="left">帐户佣金</div>
												<div class="right">
													<p><em>{$data.commission}元</em>
														<a href="javascript:;" onclick="yongj_yue()" class="edit">转余额</a>
														<a href="{:url('index/yongj_record')}" class="green">记录</a>
													</p>
												</div>
											</div>-->
											{/if}
											{if $data.user_level == 1}
											<div class="shxx_row clearfix">
												<div class="left">帐户鼓励金</div>
												<div class="right">
													<p><em>{$data.score}元</em>
														<a href="javascript:;" onclick='glj_recharge()' class="edit">购买</a>
														<!--<a href="javascript:;" onclick="glj_exchange()" class="edit">兑换到余额</a>-->
														<a href="javascript:;" onclick="glj_zz()" class="edit">转账</a>
														<a href="{:url('index/glj_record')}" class="green">记录</a>
														<!-- {if $data.user_level==1}
														<a href="javascript:;" onclick="set_cz()" class="green">设置会员购买金额</a>
														{/if} -->
													</p>
												</div>
											</div>
											{/if}
											{if $data.user_level==2 || $data.user_level==4}
												<div class="shxx_row clearfix">
													<div class="left">绑定关注默认商家ID</div>
													<div class="right">
														<p><em>{$data.ome_agent_id}</em>
															<a href="javascript:;" onclick='get_agent()' class="edit">绑定</a>  
														</p>
													</div>
												</div>
											{/if}
											<div class="shxx_row clearfix">
												<div class="left">认证状态</div>
												<div class="right">
													<p><em>
									                	{switch name="$data.is_verify"}
														    {case value="1"}已认证{/case}
														    {case value="2"}待审核{/case}
														    {case value="3"}已驳回<a href="{:url('index/renzheng')}" class="edit">去认证</a>{/case}
														    {default /}未认证<a href="{:url('index/renzheng')}" class="edit">去认证</a>
														{/switch}
									                </em></p>
												</div>
											</div>
										{/if}
										<!-- {if $data.user_level==1}
											<div class="shxx_row clearfix">
											<div class="left">兑现开关</div> 
											<div style="margin-top: -25px;">
												<form class="layui-form">
													<div class="shxx_row clearfix" style="margin-top: 20px;">
														<div class="right">
															<div class="layui-input-block" style="margin-left: 0;">
																<input type="checkbox" {if $data.sw_dx}checked{/if} lay-skin="switch" lay-filter="switchTest3" lay-text="开启|关闭" >
															</div>
														</div>
													</div>
												</form>
											</div>
											<div class="left">兑换比例</div> 
											<div style="margin-top: -25px;">
												<form class="layui-form">
													<div class="shxx_row clearfix"  style="margin-top: 20px;">
														<div class="right">
															<div class="layui-input-block" style="margin-left: 0;">
																<input type="text" id="bili" value="{$data.bili}"  class="chax_input"  style="width: 50px;">%
																<button type="button" onclick="svbl()">保存</button>
															</div>
														</div>
													</div>
												</form>
											</div>
										</div>
										
										<div class="shxx_row clearfix">
											<div class="left">新用户赠送鼓励金</div>
											<div class="right">
												<div class="layui-input-block" style="margin-left: 0;">
													<input type="text"  value="{$data.s_score}" id='s_score'  class="chax_input"  style="width: 50px;">
													<button type="button" onclick="give()">保存</button>
												</div>
											</div>
											
											赠送推荐会员开关（11鼓励金）
											<div style="margin-top: -25px;">
												<form class="layui-form">
													<div class="shxx_row clearfix" style="margin-top: 20px;">
														<div class="right">
															<div class="layui-input-block" style="margin-left: 0;">
																<input type="checkbox" {if $data.z_give}checked{/if} lay-skin="switch" lay-filter="switchTest4" lay-text="开启|关闭" >
															</div>
														</div>
													</div>
												</form>
											</div>
											
										</div>
										{/if} -->

										{if $data.user_level==2 || $data.user_level==3 || $data.user_level==4}
										<div class="shxx_row clearfix">
											<div class="left">零钱到账会员编号</div>
											<div class="right">
												<p><em>{$data.tx_id}</em>
													<a href="javascript:;" onclick='get_city()' class="edit">关联</a>  
												</p>
											</div>
										</div>
										
										<div class="shxx_row clearfix" style="color: #000000;margin-left: -30px;margin-bottom: -30px;">
											<form class="layui-form" action="">
												<div class="layui-form-item">
												    <label class="layui-form-label" style="width: 100px;">分佣到账设置</label>
												    <div class="layui-input-block">
												      <input type="radio" name="type" id="type" value="1" title="会员零钱"  {if $data['type']==1 }checked{/if}>
												      <input type="radio" name="type" id="type" value="2" title="{if $data['user_level']==4}省代理{/if} {if $data['user_level']==2}市代理{/if}{if $data['user_level']==3}运营商{/if}余额"   {if $data['type']==2 }checked{/if}>
												    </div>
												  </div> 
												  <div style="position: absolute;left: 370px;top: 2px;">
												      <button onclick="fy()" style="background: #FF7831;color: white;font-size: 12px;line-height:25px;border: none;width: 45px;border-radius:3px;">保存</button> 
											    </div>
											</form>
											<iframe id="rfFrame" name="rfFrame" src="about:blank" style="display:none;"></iframe> 
										</div>
										{/if}

										

									</div>
									<div class="shxx_jbright">
										<p class="shxx_xmimg">
											{if condition="$data.logo == null"}
											<img src="__LOGO__/1/logo.png"> {else /}
											<img src="{$data.logo}"> {/if}
										</p>
										<p class="shxx_xmnam">{$data.project_name}</p>
										<p class="shxx_xminfo">{$data.web_url}</p>
									</div>
								</div>
							</div>
							<div class="shxx_item">
								<div class="shxx_title">账号安全设置</div>
								<div class="shxx_row clearfix">
									<div class="left">登录密码</div>
									<div class="right">
										<p><em>用于登录时使用</em>
											<a href="javascript:;" onclick="return_password()" class="edit">重置</a>
										</p>
									</div>
								</div>
							</div>
							{if $data.user_level != 1}
							<div class="shxx_item">
								<div class="shxx_title">所属上级</div>
								<div class="shxx_row clearfix">
									<div class="left">{switch name="$data.user_level"}
										{case value="4"}平台{/case}
										{case value="2"}省级代理商{/case}
										{case value="3"}市级代理商{/case}
										{/switch}
									
									</div>
									<div class="right">
										<p><em>{$sysname}({$sysmobile})</em></p>
									</div>
								</div>
							</div>
							{/if}
						</div>
					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}
	</body>

</html>

<script>
	// function give(){
	// 	$.ajax({
	// 		type: 'post',
	// 		url: "{:url('index/give')}",
	// 		data: {
	// 			s_score: $("#s_score").val()
	// 		},
	// 		success: function(data) { 
	// 				layer.msg(data.msg, {
	// 					icon: 1,
	// 					time: 1000
	// 				});
	// 		}
	// 	});
	// }
	
	function svbl(){
		$.ajax({
			type: 'post',
			url: "{:url('index/svbl')}",
			data: {
				bili: $("#bili").val()
			},
			success: function(data) { 
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
			}
		});
	}
	
	
	function glj_recharge() {
		layer.open({ 
			type: 2,
			title: '购买鼓励金',
			shadeClose: true,
			shade: 0.8,
			area: ['240px', '270px'],
			content: '{:url("index/yue_score")}'
		});
	}
	function glj_exchange() {
		layer.open({
			type: 2,
			title: '鼓励金兑换到余额',
			shadeClose: true,
			shade: 0.8,
			area: ['500px', '250px'],
			content: "{:url('index/glj_exchange')}"
		});
	}
	function glj_zz() {
		layer.open({
			type: 2,
			title: '鼓励金转账',
			shadeClose: true,
			shade: 0.8,
			area: ['500px', '350px'],
			content: "{:url('index/glj_zz')}"
		});
	}
	function yue_tixian() {
		layer.open({
			type: 2,
			title: '余额提现',
			shadeClose: true,
			shade: 0.8,
			area: ['500px', '400px'],
			content: "{:url('index/yue_tixian')}"
		});
	}

	function return_password() {
		layer.open({
			type: 2,
			title: '重置登录密码',
			shadeClose: true,
			shade: 0.8,
			area: ['500px', '250px'],
			content: "{:url('index/return_password')}"
		});
	}

	function return_operationpwd() {
		layer.open({
			type: 2,
			title: '重置操作密码',
			shadeClose: true,
			shade: 0.8,
			area: ['500px', '250px'],
			content: "{:url('index/return_operationpwd')}"
		});
	}

	function show_agent() {
		layer.open({
			type: 2,
			title: '修改信息',
			shadeClose: false,
			shade: 0.8,
			area: ['500px', '450px'],
			content: "{:url('index/show_agent',['id'=>session('d_id')])}"
		});
	}
	
	function show_oem_pt(){
		layer.open({
			type: 2,
			title: '修改商家信息',
			shadeClose: true,
			shade: 0.8,
			area: ['460px', '260px'],
			content: "{:url('index/show_oem_pt')}"
		});
	}
	
	
	layui.use(['form', 'layedit', 'laydate'], function() {
		var form = layui.form;
        var jquery = layui.jquery;
        var layer = layui.layer;
		
		//监听指定开关（储值卡开关） 
		form.on('switch(switchTest3)', function (data) {
            var checked=data.elem.checked; 
          	var flag = 0; //1开启  0关闭
			if(checked ) {
				flag = 1;
			}
			storage_switch(flag);
        });
		
		//赠送开关
		form.on('switch(switchTest4)', function (data) {
            var checked=data.elem.checked; 
          	var flag = 0; //1开启  0关闭
			if(checked ) {
				flag = 1;
			}
			zs_switch(flag);
        });

		//监听提交
		form.on('submit(demo1)', function(data) {
			layer.alert(JSON.stringify(data.field), {
				title: '最终的提交信息'
			})
			return false;
		});

	});

	
	
	

    function storage_switch(storage_switch){ 
    	$.ajax({
			type: 'post',
			url: "{:url('index/switch_glj')}",
			dataType: 'json',
			data: {
				storage_switch: storage_switch
			},
			success: function(data) { 
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
			}
		});
    }

	function set_cz() {
		var url = "{:url('index/set_cz')}";
		layer.open({
			type: 2,
			title: '鼓励金购买设置',
			shadeClose: true,
			shade: 0.8,
			area: ['600px', '550px'],
			content: [url]
		});
	} 
	
	
	function zs_switch(storage_switch){ 
    	$.ajax({
			type: 'post',
			url: "{:url('index/zs_switch')}",
			dataType: 'json',
			data: {
				storage_switch: storage_switch
			},
			success: function(data) { 
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
			}
		});
    }

    //关联会员ID
    function get_city(){
    	var url = "{:url('index/get_city')}";
		layer.open({
			type: 2,
			title: '关联会员ID设置',
			shadeClose: true,
			shade: 0.8,
			area: ['400px', '250px'],
			content: [url]
		});
    }

	//关联商家ID
    function get_agent(){
    	var url = "{:url('index/get_agent')}";
		layer.open({
			type: 2,
			title: '关注默认商家ID设置',
			shadeClose: true,
			shade: 0.8,
			area: ['400px', '250px'],
			content: [url]
		});
    }
    
    //分佣
    function fy(){
    	JS:document.forms[0].target="rfFrame"; 
        JQuery:$("#f2").attr("target","rfFrame");
    	var type = $("input[name='type']:checked").val();  
    	
    	
    	
    	$.ajax({
			type: 'post',
			url: "{:url('index/fy')}",
			dataType: 'json',
			data: {
				type: type
			},
			success: function(data) { 
				layer.msg(data.msg, {
						icon: 1,
						time: 1000
				});
			}
		});
    }
</script>
